package org.bing.engine.console.service;

import org.bing.engine.common.filter.ServletContextInfo;
import org.bing.engine.common.filter.ServletContextManager;
import org.bing.engine.core.domain.Console;

public class ConsoleNodeGenerator implements ServletContextManager {
    private Console console;

    public Console getThisConsole() {
        if (console == null) {
            throw new RuntimeException("Pls init this console node first!");
        }
        return console;
    }

    public void setThisConsole(Console console) {
        this.console = console;
    }

    public void manage(ServletContextInfo info) {
        console = new Console();
        console.setAddress(info.getServerName());
        console.setHostname("");
        console.setPort(info.getServerPort());
        // TODO impl set globalId
    }
}
